var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var autoprefixer = require('autoprefixer');

module.exports = {
    entry: {
        index:['./public/javascripts/src/index.jsx']
    },
    //plugins: [
    //    new webpack.HotModuleReplacementPlugin(),
    //    //new webpack.NoErrorsPlugin(),
    //    //new webpack.optimize.UglifyJsPlugin({compress: {warnings: false}}),
    //    new webpack.DefinePlugin({
    //        __DEBUG__: JSON.stringify(JSON.parse(process.env.DEBUG || 'false'))
    //    })
    //],
    output: {
        path: __dirname+"/public/javascripts/build",
        filename: '[name].js' },
    resolve: {
        extensions: ['', '.js', '.json', '.scss']
    },
    module: {
        loaders: [
            {
                test: /.jsx?$/,
                loader: 'babel-loader',
                exclude: /node_modules/,
                query: {
                    presets: ['es2015', 'react']
                }
            },
            {
                test: /(\.scss|\.css)$/,
                loader: ExtractTextPlugin.extract('style-loader', 'css?sourceMap&modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss!sass?sourceMap')
            }
        ]
    },
    postcss: [autoprefixer],
    plugins: [
        new ExtractTextPlugin('bundle.css', {allChunks: true}),
        new webpack.optimize.OccurenceOrderPlugin(),
        new webpack.NoErrorsPlugin()
    ]
};